
#include "../source/client/rpc_client.hpp"
#include "unistd.h"

using namespace std;

void callback(const Json::Value &res)
{
    ILOG("callback ret: %d", res.asInt());
}

void testclientRpc()
{

    Rpc::client::RpcClient client(false,"127.0.0.1",8080);

    Json::Value pramas, r;

    pramas["num1"] = 10;
    pramas["num2"] = 20;

    // Rpc::client::RpcCaller::JsonAsyncResponse res_future;
    // bool ret = caller->call(conn, "Add", pramas, res_future);
    // if (ret == true)
    // {
    //     int result = res_future.get().asInt();
    //     // cout << "result:" << result.asInt() << endl;
    //     cout << "result:" << result << endl;
    // }
    bool res = client.call("Add", pramas, callback);


    sleep(10);
}

int main()
{
    testclientRpc();

    return 0;
}